/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Daniel Cruz
 */
@Entity
@Table(name = "b_permiso_menu")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BPermisoMenu.findAll", query = "SELECT b FROM BPermisoMenu b"),
    @NamedQuery(name = "BPermisoMenu.findByPermId", query = "SELECT b FROM BPermisoMenu b WHERE b.bPermisoMenuPK.permId = :permId"),
    @NamedQuery(name = "BPermisoMenu.findByPerId", query = "SELECT b FROM BPermisoMenu b WHERE b.bPermisoMenuPK.perId = :perId"),
    @NamedQuery(name = "BPermisoMenu.findByMenId", query = "SELECT b FROM BPermisoMenu b WHERE b.bPermisoMenuPK.menId = :menId"),
    @NamedQuery(name = "BPermisoMenu.findByPermAppId", query = "SELECT b FROM BPermisoMenu b WHERE b.permAppId = :permAppId"),
    @NamedQuery(name = "BPermisoMenu.findByPermCad", query = "SELECT b FROM BPermisoMenu b WHERE b.permCad = :permCad"),
    @NamedQuery(name = "BPermisoMenu.findByPermDesc1", query = "SELECT b FROM BPermisoMenu b WHERE b.permDesc1 = :permDesc1"),
    @NamedQuery(name = "BPermisoMenu.findByPermDesc2", query = "SELECT b FROM BPermisoMenu b WHERE b.permDesc2 = :permDesc2"),
    @NamedQuery(name = "BPermisoMenu.findByPermDesc3", query = "SELECT b FROM BPermisoMenu b WHERE b.permDesc3 = :permDesc3"),
    @NamedQuery(name = "BPermisoMenu.findByPermDesc4", query = "SELECT b FROM BPermisoMenu b WHERE b.permDesc4 = :permDesc4")})
public class BPermisoMenu implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BPermisoMenuPK bPermisoMenuPK;
    @Size(max = 10)
    @Column(name = "perm_app_id")
    private String permAppId;
    @Size(max = 255)
    @Column(name = "perm_cad")
    private String permCad;
    @Size(max = 100)
    @Column(name = "perm_desc1")
    private String permDesc1;
    @Size(max = 100)
    @Column(name = "perm_desc2")
    private String permDesc2;
    @Size(max = 100)
    @Column(name = "perm_desc3")
    private String permDesc3;
    @Size(max = 100)
    @Column(name = "perm_desc4")
    private String permDesc4;
    @JoinColumn(name = "per_id", referencedColumnName = "per_id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private BPerfil bPerfil;
    @JoinColumn(name = "men_id", referencedColumnName = "men_id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private BMenu bMenu;

    public BPermisoMenu() {
    }

    public BPermisoMenu(BPermisoMenuPK bPermisoMenuPK) {
        this.bPermisoMenuPK = bPermisoMenuPK;
    }

    public BPermisoMenu(long permId, long perId, long menId) {
        this.bPermisoMenuPK = new BPermisoMenuPK(permId, perId, menId);
    }

    public BPermisoMenuPK getBPermisoMenuPK() {
        return bPermisoMenuPK;
    }

    public void setBPermisoMenuPK(BPermisoMenuPK bPermisoMenuPK) {
        this.bPermisoMenuPK = bPermisoMenuPK;
    }

    public String getPermAppId() {
        return permAppId;
    }

    public void setPermAppId(String permAppId) {
        this.permAppId = permAppId;
    }

    public String getPermCad() {
        return permCad;
    }

    public void setPermCad(String permCad) {
        this.permCad = permCad;
    }

    public String getPermDesc1() {
        return permDesc1;
    }

    public void setPermDesc1(String permDesc1) {
        this.permDesc1 = permDesc1;
    }

    public String getPermDesc2() {
        return permDesc2;
    }

    public void setPermDesc2(String permDesc2) {
        this.permDesc2 = permDesc2;
    }

    public String getPermDesc3() {
        return permDesc3;
    }

    public void setPermDesc3(String permDesc3) {
        this.permDesc3 = permDesc3;
    }

    public String getPermDesc4() {
        return permDesc4;
    }

    public void setPermDesc4(String permDesc4) {
        this.permDesc4 = permDesc4;
    }

    public BPerfil getBPerfil() {
        return bPerfil;
    }

    public void setBPerfil(BPerfil bPerfil) {
        this.bPerfil = bPerfil;
    }

    public BMenu getBMenu() {
        return bMenu;
    }

    public void setBMenu(BMenu bMenu) {
        this.bMenu = bMenu;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bPermisoMenuPK != null ? bPermisoMenuPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BPermisoMenu)) {
            return false;
        }
        BPermisoMenu other = (BPermisoMenu) object;
        if ((this.bPermisoMenuPK == null && other.bPermisoMenuPK != null) || (this.bPermisoMenuPK != null && !this.bPermisoMenuPK.equals(other.bPermisoMenuPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.BPermisoMenu[ bPermisoMenuPK=" + bPermisoMenuPK + " ]";
    }
    
}
